import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsArray, IsDateString, IsNotEmpty, IsNumber, IsOptional, IsString, ValidateNested } from 'class-validator';

export class StudentMainPlanItemDto {
  @ApiProperty({ description: '主计划名称' })
  @IsString()
  @IsNotEmpty()
  planName: string;

  @ApiProperty({ description: '子计划列表，多个子计划用-分隔，例如: "阅读-写作-口语"' })
  @IsString()
  @IsNotEmpty()
  subPlans: string;

  @ApiProperty({ description: '打卡开始时间', required: false })
  @IsDateString()
  @IsOptional()
  punchStartAt?: string;

  @ApiProperty({ description: '计划备注', required: false })
  @IsString()
  @IsOptional()
  mark?: string;
}

export class StudentCreateMainPlanDto {
  @ApiProperty({ description: '学生ID' })
  @IsNumber()
  @IsNotEmpty()
  studentId: number;

  @ApiProperty({ description: '主计划列表', type: [StudentMainPlanItemDto] })
  @IsArray()
  @ValidateNested({ each: true })
  @Type(() => StudentMainPlanItemDto)
  plans: StudentMainPlanItemDto[];
} 